<template>
  <XtxBread>
    <XtxBreadItem to="/">首页</XtxBreadItem>
    <!-- 一级分类 -->
    <XtxBreadItem :to="`/category/${subCategoryData.parentId}`">
      {{ subCategoryData.parentName }}
    </XtxBreadItem>
    <!-- 二级分类 -->
    <XtxBreadItem>{{ subCategoryData.name }}</XtxBreadItem>
  </XtxBread>
</template>

<script>
import { inject } from 'vue'
export default {
  setup () {
    // 接收父组件provide数据
    const subCategoryData = inject('subCateData')

    return { subCategoryData }
  }
}
</script>
